{extend name="layouts/main" /}
{block name="link"}{/block}
{block name="content"}
<div class="layui-tab layui-tab-brief" lay-filter="demoTitle">
	<div class="layui-body layui-tab-content site-demo site-demo-body" style="top: 0px;left: 0px;">
		<div class="layui-tab-item layui-show">
			<div class="layui-main">
				<div id="LAY_preview">
					<div class="layui-fluid" style="position: relative;margin: 0 auto;padding: 0 0px;">
						<div class="layui-set">
							<div class="layui-set-from search-form">
								<form class="layui-form add-user" action="{:url('add_to_group_access')}" method="post" enctype="application/x-www-form-urlencoded">
									<div class="layui-form-item" style="margin-bottom: -8px;">
										<div class="layui-input-inline">
											<select name="group"  lay-verify="required" lay-filter="group">
												{volist name="allAuthGroupRes" id="info"}
												<option value="{:url('user',array('group_id'=>$info['id']))}" {if condition="$group_id eq $info['id']"}selected="selected"{/if}>{$info.title}</option>
												{/volist}
											</select>
										</div>
										<div class="layui-input-inline">
											<select name="uid" lay-verify="required">
												<option value="">选择管理员</option>
												{volist name="allAdminRes" id="info"}
												<option value="{$info.id}">{$info.name}</option>
												{/volist}
											</select>
										</div>
										<div class="layui-input-inline" style="width:80px">
											<input type="hidden" name="group_id" value="{$group_id}">
											<button class="layui-btn ajax-post" type="submit" data-type="reload"  target-form="add-user">新增成员</button>
										</div>
									</div>
								</form>
							</div>
						</div>
						<div class="layui-card" style="overflow-y: hidden;float: left;width: 100%;">
							<form class="layui-form form-horizontal" action="{:url()}" method="post">
								<input type="hidden" name="group_id" value="{$group_id}">
								<table class="layui-table" lay-filter="tableEvent">
									<colgroup>
										<col width="1%">
										<col width="5%">
										<col width="6%">
										<col>
										<col width="12%">
										<col width="20%">
									</colgroup>
									<thead>
										<tr>
											<th>
												<input type="checkbox" name="" lay-skin="primary" id="allChoose" lay-filter="allChoose">
											</th>
											<th>ID</th>
											<th>序号</th>
											<th>管理员账号</th>
											<th>状态</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody>
										{volist name="currentGroupAdminRes" id="info"}
										<tr>
											<td>
												{if condition="$info.id neq 1"}
												<input type="checkbox" lay-skin="primary" lay-filter="c_one" class="ids" name="ids[]" value="{$info.id}">
												{/if}
											</td>
											<td>{$info.id}</td>
											<td>
												<input type="text" name="sort[{$info.id}]" value="{$info.sort}" class="layui-input sort" lay-filter="weight">
											</td>
											<td>{$info.name}</td>
											<td>{$info.status_text}</td>
											<td>
												{if condition="$info['status'] eq 0"}
												<div class="layui-inline">
													<a class="layui-btn layui-btn-xs layui-btn-normal ajax-get" href="{:url('Admin/setStatus',array('ids'=>$info['id'],'status'=>1))}">
														<i class="layui-icon layui-icon-release"></i> 启用
													</a>
												</div>
												{else/}
												<div class="layui-inline">
													<a class="layui-btn layui-btn-xs layui-btn-warm ajax-get" href="{:url('Admin/setStatus',array('ids'=>$info['id'],'status'=>0))}">
														<i class="layui-icon layui-icon-set-fill"></i> 禁用
													</a>
												</div>
												{/if}
												<div class="layui-inline">
													<a class="layui-btn layui-btn-xs layui-btn-danger confirm ajax-get" url="{:url('remove_user',array('uid'=>$info['id'],'group_id'=>$group_id))}">
														<i class="layui-icon layui-icon-delete"></i> 解除
													</a>
												</div>
											</td>
										</tr>
										{/volist}
										<tr>
											<td align="left" colspan="10" style="padding-left:0;">
												&nbsp;
												<div class="layui-inline">
													<a href="" class="layui-btn layui-btn-sm ajax-post" target-form="sort" url="{:url('Admin/sort')}">&nbsp;排序&nbsp;</a>
												</div>
												<div class="layui-inline">
													<a href="" class="layui-btn layui-btn-sm layui-btn-normal ajax-post" target-form="ids" url="{:url('Admin/setStatus',array('status'=>1))}">启用</a>
												</div>
												<div class="layui-inline">
													<a href="" class="layui-btn layui-btn-sm layui-btn-warm ajax-post" target-form="ids" url="{:url('Admin/setStatus',array('status'=>0))}">禁用</a>
												</div>
												<div class="layui-inline">
													<a href="" class="layui-btn layui-btn-sm layui-btn-danger confirm ajax-post" target-form="form-horizontal" url="{:url('remove_user')}">解除绑定</a>
												</div>
											</td>
										</tr>
									</tbody>
								</table>
							</form>
							<!-- <div id="page">
								<div class="layui-box layui-laypage layui-laypage-default">
									<div class="pagelistbox">
										<span>共 2 页/31条记录 </span>
										<span class="indexPage">首页 </span>
										<strong>1</strong>
										<a href="#">2</a>
										<a class="nextPage" href="#">下页</a>
										<a class="endPage" href="#">末页</a>
									</div>
								</div>
							</div> -->
							<!-- <div class="layui-box layui-laypage layui-laypage-default" id="layui-laypage-10"><span class="layui-laypage-prev">共 2 页/31条记录</span><a href="javascript:;" class="layui-laypage-prev" data-page="1">首页</a><a href="javascript:;" class="layui-laypage-prev" data-page="1">上一页</a><a href="javascript:;" data-page="1">1</a><span class="layui-laypage-curr"><em class="layui-laypage-em"></em><em>2</em></span><a href="javascript:;" data-page="3">3</a><a href="javascript:;" data-page="4">4</a><a href="javascript:;" data-page="5">5</a><span class="layui-laypage-spr">…</span><a href="javascript:;" class="layui-laypage-last" title="尾页" data-page="10">10</a><a href="javascript:;" class="layui-laypage-next" data-page="3">下一页</a><a href="javascript:;" class="layui-laypage-next" data-page="3">尾页</a><a href="javascript:;" data-page="2" class="layui-laypage-refresh"><i class="layui-icon layui-icon-refresh"></i></a><span class="layui-laypage-skip">到第<input type="text" min="1" value="2" class="layui-input">页<button type="button" class="layui-laypage-btn">确定</button></span></div> -->
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
{/block}
{block name="js"}
<script type="text/javascript">
	$(function() {
    	$("select[name='status']").val({$status|default = ''});
    });
</script>
<script type="text/javascript">
	layui.use(['form','jquery'], function(){
		var form = layui.form
		,$ = layui.jquery;
		// 下拉菜单改变值触发事件
		form.on('select(group)', function(data){
			location.href = data.value;
		});
	});
</script>
{/block}